package com.bridgeintelligent.tag.webserver.schedule.service.imp;

import com.bridgeintelligent.tag.webserver.schedule.api.IStopService;
import com.bridgeintelligent.tag.webserver.schedule.service.mapper.TagStopMapper;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @description
 * @author: grp 2021-01-13 11:34
 **/
@Service
@AllArgsConstructor
@Slf4j
public class TagStopServiceImpl implements IStopService {

    private TagStopMapper tagStopMapper;

    @Override
    public void stopCustomers() {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        int count = tagStopMapper.stopCustomers(sdf.format(new Date()));
        log.info("共有{}个客群变为失效！",count);
    }

    @Override
    public void stopTags(String date) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        int count = tagStopMapper.stopTags(sdf.format(new Date()),date);
        log.info("共有{}个标签变为停用！",count);
    }
}
